package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.ExecutionRecordDetailsMapper;
import com.ruoyi.web.domain.ExecutionRecordDetails;
import com.ruoyi.web.service.IExecutionRecordDetailsService;
import com.ruoyi.common.core.text.Convert;

/**
 * detailsService业务层处理
 * 
 * @author drx
 * @date 2023-10-19
 */
@Service
public class ExecutionRecordDetailsServiceImpl implements IExecutionRecordDetailsService 
{
    @Autowired
    private ExecutionRecordDetailsMapper executionRecordDetailsMapper;

    /**
     * 查询details
     * 
     * @param id details主键
     * @return details
     */
    @Override
    public ExecutionRecordDetails selectExecutionRecordDetailsById(Long id)
    {
        return executionRecordDetailsMapper.selectExecutionRecordDetailsById(id);
    }

    /**
     * 查询details列表
     * 
     * @param executionRecordDetails details
     * @return details
     */
    @Override
    public List<ExecutionRecordDetails> selectExecutionRecordDetailsList(ExecutionRecordDetails executionRecordDetails)
    {
        return executionRecordDetailsMapper.selectExecutionRecordDetailsList(executionRecordDetails);
    }

    /**
     * 新增details
     * 
     * @param executionRecordDetails details
     * @return 结果
     */
    @Override
    public int insertExecutionRecordDetails(ExecutionRecordDetails executionRecordDetails)
    {
        executionRecordDetails.setCreateTime(DateUtils.getNowDate());
        executionRecordDetails.setCreateBy(ShiroUtils.getSysUser().getLoginName());
        return executionRecordDetailsMapper.insertExecutionRecordDetails(executionRecordDetails);
    }

    /**
     * 修改details
     * 
     * @param executionRecordDetails details
     * @return 结果
     */
    @Override
    public int updateExecutionRecordDetails(ExecutionRecordDetails executionRecordDetails)
    {
        executionRecordDetails.setUpdateTime(DateUtils.getNowDate());
        return executionRecordDetailsMapper.updateExecutionRecordDetails(executionRecordDetails);
    }

    /**
     * 批量删除details
     * 
     * @param ids 需要删除的details主键
     * @return 结果
     */
    @Override
    public int deleteExecutionRecordDetailsByIds(String ids)
    {
        return executionRecordDetailsMapper.deleteExecutionRecordDetailsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除details信息
     * 
     * @param id details主键
     * @return 结果
     */
    @Override
    public int deleteExecutionRecordDetailsById(Long id)
    {
        return executionRecordDetailsMapper.deleteExecutionRecordDetailsById(id);
    }

    @Override
    public void truncateTable(String loginName){
        executionRecordDetailsMapper.truncateTable(loginName);
    }
}
